<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport"
    content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no" />
  <title>首页</title>
  <link rel="stylesheet" href="../../css/reset.css" />
  <style>
    body {
      background-color: #fff;
    }

    .addImage {
      width: 100%;
      height: 100%;
      background-image: url("../../image/jiesuobgx.png");
      background-size: 100% 100%;
      position: relative;
    }
  </style>
</head>

<body>
  <div class="addImage">
    <span id="closedoor"
      style="display:inline-block;width:1.42rem;height:0.4rem;line-height: 0.4rem;font-size:0.28rem;position: absolute;top:5%;left:4%;text-align: left;display:none;">
      取消
    </span>
    <img src="../../image/renrenicon.png"
      style="width:1.42rem;height:1.42rem;position: absolute;top:15%;left:calc((100% - 1.42rem) / 2)" />
  </div>
</body>
<script src="../../script/autosize.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/app.js"></script>
<script>
  apiready = function () {
    var app = new APP();
    var count = 0;
    app.back(function () {
      //禁止手机按返回键返回页面
      return false;
    });
    app.log("是否显示返回按钮++++++++++=", api.pageParam.showBack);
    if (api.pageParam.showBack == true) {
      $("#closedoor").show();
    } else {
      $("#closedoor").hide();
    }
    var matrixLock = api.require("matrixLock");
    var accountSet = app.getAccountSet();
    matrixLock.checkGesture(function (ret, err) {
      if (ret.code == 0) {
        matrixLock.openEnterView({
          bg: "rgba(255,255,255,0)",
          x: 0,
          y: app.H * 0.45,
          matrix: {
            radius: 52,
            normalLine: api.pageParam.lineColor,
            activeBg: "#ffcf07",
            arrow: api.pageParam.lineColor,
            errorLine: api.pageParam.errLineColor,
            arrowError: api.pageParam.errLineColor
          }
        },
                function (ret, err) {
          if (ret.status) {
            if (api.pageParam.changePassword == "true") {
              matrixLock.clearGesture();
              matrixLock.closeEnterView();
              matrixLock.openSetView({
                bg: "rgba(255,255,255,0)",
                x: 0,
                y: app.H * 0.3,
                matrix: {
                  radius: 52,
                  normalLine: api.pageParam.lineColor,
                  activeBg: "#ffcf07",
                  arrow: api.pageParam.lineColor,
                  errorLine: api.pageParam.errLineColor,
                  arrowError: api.pageParam.errLineColor
                }
              }, function (ret, err) {
                if (ret.status) {
                  app.toast("密码设置成功");
                  matrixLock.closeEnterView();
                  api.closeWin({
                    name: "checkhand"
                  });
                }
              }
              );
              return;
            }
            if (api.pageParam.closeHandLine == "true") {
              app.trigger("quithandLine");
              var accountSet = app.getAccountSet();
              accountSet.openHandPassword = false;
              app.setAccount(accountSet);
              app.toast("已关闭手势密码");
            }
            app.trigger("passwordSucessful");
            app.closeW("checkhand");
            matrixLock.closeEnterView();
          } else {
            count++;
            if (count > 4) {
              console.log("counts" + count);
              matrixLock.clearGesture();
              app.delAccount();
              app.closeW('safetyset');
              app.trigger("quit_login");
              app.trigger("closeWinDow");
              setTimeout(function (params) {
                app.closeW();
              }, 1000)
            }
          }
        }
        );
      } else {
        matrixLock.openSetView({
          bg: "rgba(255,255,255,0)",
          x: 0,
          y: app.H * 0.3,
          matrix: {
            radius: 52,
            activeBg: "#ffcf07",
            normalLine: api.pageParam.lineColor,
            arrow: api.pageParam.lineColor,
            errorLine: api.pageParam.errLineColor,
            arrowError: api.pageParam.errLineColor
          }
        },
          function (ret, err) {
            if (ret.status) {
              app.toast("密码设置成功");
              matrixLock.closeEnterView();
              api.closeWin({
                name: "checkhand"
              });
            }
          }
        );
      }
    });
    $("#closedoor").on("click", function () {
      accountSet.openHandPassword = false;
      app.setAccount(accountSet);
      app.trigger("backF");
      app.closeW();
    });
  };
</script>

</html>